package com.dbappsecurity.bifrost;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Build;
import android.support.multidex.MultiDex;
import cn.jpush.android.api.JPushInterface;
import com.dbapp.uilib.UiLab;
import com.dbappsecurity.bifrost.di.component.AppComponent;
import com.dbappsecurity.bifrost.di.component.DaggerAppComponent;
import com.dbappsecurity.core.CoreApplication;
import com.dbappsecurity.jsbridge.JsLib;
import com.mob.MobSDK;
import java.util.Objects;

//import com.baidu.mapapi.SDKInitializer;

//import static com.baidu.mapapi.CoordType.GCJ02;

public class BifrostApp extends CoreApplication {

  public static AppComponent sAppComponent;

  @Override
  public void onCreate() {
    super.onCreate();

    sAppComponent = DaggerAppComponent.builder().app(this).build();

    JsLib.init(this);
    UiLab.init(this);

    JPushInterface.setDebugMode(true);
    JPushInterface.init(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { //仅在 api 26 以上生效
      NotificationChannel channel =
          new NotificationChannel(getResources().getString(R.string.app_name),
              getResources().getString(R.string.app_name),
              NotificationManager.IMPORTANCE_HIGH);
      channel.setDescription("请开启此通知频道");
      Objects.requireNonNull(getSystemService(NotificationManager.class))
          .createNotificationChannel(channel);
    }
    MobSDK.init(this);
  }

  @Override
  protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
  }
}
